package com.sky.mapper;

import com.sky.entity.Category;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface CategoryMapper {

    void update(Category category);

    List<Category> getByConditions(String name, Integer type);

    @Update("update category set status = #{status} where id = #{id}")
    void updateStatus(Integer status, Long id);

    @Insert("insert into category (name,sort,type,create_time,create_user,update_time,update_user) " +
            "values (#{name},#{sort},#{type},#{createTime},#{createUser},#{updateTime},#{updateUser})")
    void add(Category category);

    @Delete("delete from category where id = #{id}")
    void deleteById(Long id);
}
